﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
public partial class zoushitu_dlt_dlt_hqc3 : System.Web.UI.Page
{
    protected List<Model.LotteryAnnouncement> arlist = null;
    protected string[] SSQList = null;
    protected string SSQblue = null;
    protected DataTable dtPaperList = new DataTable();
    protected int jinqiCount = 0;


    protected Hashtable hqy2_dt = new Hashtable();//除3余2
    protected Hashtable hqy0_dt = new Hashtable();//除3余0
    protected Hashtable hqy1_dt = new Hashtable();//除3余1

    protected Hashtable hqy2_tiao = new Hashtable();
    protected Hashtable hqy0_tiao = new Hashtable();
    protected Hashtable hqy1_tiao = new Hashtable();

    protected Hashtable flag1_dt = new Hashtable();
    protected Hashtable flag2_dt = new Hashtable();

    protected List<List<List<string>>> flag1_List = new List<List<List<string>>>();//后区篮球
    protected List<List<List<string>>> flag2_List = new List<List<List<string>>>();//后区篮球
    protected List<List<string>> flag1_tiaoList = new List<List<string>>();
    protected List<List<string>> flag2_tiaoList = new List<List<string>>();
    protected int TiaoXing;
    protected void Page_Load(object sender, EventArgs e)
    {
        ZoushiManage.FangWenZouShi();
        if (!IsPostBack)
        {
            jinqiCount = 30;
            bindData(30);

        }
    }

    protected void bindData(int maxValue)
    {
        arlist = BLL.LotteryAnnouncement.getDatas(maxValue,2);

        if (arlist != null)
        {
            #region 列表初始化   
            hqy0_dt.Add(0, 03);
            hqy0_dt.Add(1, 06);
            hqy0_dt.Add(2, 09);
            hqy0_dt.Add(3, 12);

            hqy1_dt.Add(4, 01);
            hqy1_dt.Add(5, 04);
            hqy1_dt.Add(6, 07);
            hqy1_dt.Add(7, 10);

            hqy2_dt.Add(8, 02);
            hqy2_dt.Add(9, 05);
            hqy2_dt.Add(10, 08);
            hqy2_dt.Add(11, 11);





            flag1_dt.Add(12, 0);
            flag1_dt.Add(13, 1);
            flag1_dt.Add(14, 2);

            flag2_dt.Add(15, 0);
            flag2_dt.Add(16, 1);
            flag2_dt.Add(17, 2);


            #endregion
            int[] hy0 = { 3, 6, 9, 12 };
            int[] hy1 = { 1, 4, 7, 10 };
            int[] hy2 = { 2, 5, 8, 11 };
            int yi2_count = 0;
            int yi0_count = 0;
            int yi1_count = 0;
            int yii2_count = 0;
            int yii0_count = 0;
            int yii1_count = 0;
            for (int i = 0; i < arlist.Count; i++)
            {

                string lotteryqs = arlist[i].LotteryQS;
                string[] blueBall = arlist[i].LotteryNo.Split('+')[1].Split(',');//篮球

                for (int m = 0; m < blueBall.Length; m++)
                {
                    //计算条形图中每个数的个数红球
                    bindTiaoxing(1, int.Parse(blueBall[m]));

                    List<List<string>> hq1_list = new List<List<string>>();
                    List<List<string>> hq2_list = new List<List<string>>();
                    #region
                    if (m == 0)
                    {
                        List<string> list1 = new List<string>();
                        if (int.Parse(blueBall[m]) % 3 == 0)
                        {
                            list1.Add(lotteryqs);
                            list1.Add("12");
                            list1.Add("0");
                            hq1_list.Add(list1);
                            yi0_count = yi0_count + 1;
                        }

                        list1 = new List<string>();
                        if (int.Parse(blueBall[m]) % 3 == 1)
                        {
                            list1.Add(lotteryqs);
                            list1.Add("13");
                            list1.Add("1");
                            hq1_list.Add(list1);
                            yi1_count = yi1_count + 1;
                        }

                        list1 = new List<string>();
                        if (int.Parse(blueBall[m]) % 3 == 2)
                        {
                            list1.Add(lotteryqs);
                            list1.Add("14");
                            list1.Add("2");
                            hq1_list.Add(list1);
                            yi2_count = yi2_count + 1;
                        }

                        flag1_List.Add(hq1_list);
                    }
                    else
                    {
                        List<string> list2 = new List<string>();
                        if (int.Parse(blueBall[m]) % 3 == 2)
                        {
                            list2.Add(lotteryqs);
                            list2.Add("17");
                            list2.Add("2");
                            hq2_list.Add(list2);
                            yii2_count = yii2_count + 1;
                        }

                        list2 = new List<string>();
                        if (int.Parse(blueBall[m]) % 3 == 0)
                        {
                            list2.Add(lotteryqs);
                            list2.Add("15");
                            list2.Add("0");
                            hq2_list.Add(list2);
                            yii0_count = yii0_count + 1;
                        }

                        list2 = new List<string>();
                        if (int.Parse(blueBall[m]) % 3 == 1)
                        {
                            list2.Add(lotteryqs);
                            list2.Add("16");
                            list2.Add("1");
                            hq2_list.Add(list2);
                            yii1_count = yii1_count + 1;
                        }

                        flag2_List.Add(hq2_list);
                    }
                    #endregion
                }

            }


            #region


            foreach (DictionaryEntry de in hqy0_dt)
            {
                int a = int.Parse(de.Value.ToString()) + 34;
                string b = TiaoxingDT[a].ToString();
                hqy0_tiao.Add(de.Key, b);
            }
            foreach (DictionaryEntry de in hqy1_dt)
            {
                int a = int.Parse(de.Value.ToString()) + 34;
                string b = TiaoxingDT[a].ToString();
                hqy1_tiao.Add(de.Key, b);
            }

            foreach (DictionaryEntry de in hqy2_dt)
            {
                int a = int.Parse(de.Value.ToString()) + 34;
                string b = TiaoxingDT[a].ToString();
                hqy2_tiao.Add(de.Key, b);
            }
            for (int t = 0; t < 3; t++)
            {
                List<string> yilist = new List<string>();
                List<string> yiilist = new List<string>();

                if (t == 0)
                {
                    yilist.Add("0");
                    yilist.Add(yi0_count.ToString());
                    yiilist.Add("0");
                    yiilist.Add(yii0_count.ToString());
                }
                else if (t == 1)
                {
                    yilist.Add("1");
                    yilist.Add(yi1_count.ToString());
                    yiilist.Add("1");
                    yiilist.Add(yii1_count.ToString());
                }
                else if (t == 2)
                {
                    yilist.Add("2");
                    yilist.Add(yi2_count.ToString());
                    yiilist.Add("2");
                    yiilist.Add(yii2_count.ToString());
                }

                flag1_tiaoList.Add(yilist);
                flag2_tiaoList.Add(yiilist);
            }
            #endregion
        }



    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        jinqiCount = int.Parse(DropDownList1.SelectedValue);
        bindData(int.Parse(DropDownList1.SelectedValue));

    }
    protected int[] TiaoxingDT = new int[47];
    protected void bindTiaoxing(int type, int data)
    {
        for (int i = 0; i < 47; i++)
        {
            if (type == 0)
            {
                if (data == (i + 1))
                {
                    TiaoxingDT[i] += 1;
                }
            }
            if (type == 1)
            {
                if (data == (i + 1 - 35))
                {
                    TiaoxingDT[i] += 1;
                }
            }
        }
    }
}